package ink.lovejinhu.think.java;

import java.util.Scanner;

/**
 * @author jinhu
 * created 2021-08-06 16:18
 */
public class ThinkInput {
    public static void main(String[] args) {
        test01();
    }

    /**
     * nextLine,只以回车结束
     * next.以空格，tab，回车结束
     */
    public static void test01() {
        Scanner scanner = new Scanner(System.in);
        String nextLine = scanner.nextLine();
        System.out.println("nextLine:" + nextLine);
        String next = scanner.next();
        System.out.println("next:" + next);
    }

    /**
     * nextLine会将next因空格提前结束的串直接读取，导致nextLine不能读取
     */
    public static void test02() {
        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();
        System.out.println("next:" + next);
        String nextLine = scanner.nextLine();
        System.out.println("nextLine:" + nextLine);

    }
}
